package com.chao.yyks.modular.score.controller;

import com.alibaba.fastjson.JSONObject;
import com.chao.common.util.log.Inter;
import com.chao.common.util.reaction.PageList;
import com.chao.yyks.modular.score.bean.EnAnswer;
import com.chao.yyks.modular.score.service.EnAnswerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * 成绩答题Controller
 * chao
 * 2024-09-13
 */
@RestController
@RequestMapping("/enAnswer")
public class EnAnswerController {

	/**
	 * 成绩答题Service
	 */
	@Autowired
	private EnAnswerService enAnswerService;

	/**
	 * 修改成绩答题
	 */
	@Inter("EAR_EDT_01")
	@RequestMapping(method = RequestMethod.POST, value = "updateEnAnswer")
	public void updateEnAnswer(@RequestBody EnAnswer enAnswer){
		enAnswerService.updateEnAnswer(enAnswer);
	}

	/**
	 * 查询成绩答题详情
	 */
	@Inter("EAR_SEL_02")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnAnswerByScoreId")
	public EnAnswer selectEnAnswerByScoreId(String scoreId,String problemId){
		return enAnswerService.selectEnAnswerByScoreId(scoreId,problemId);
	}

	/**
	 * 分页查询成绩答题列表
	 */
	@Inter("EAR_SEL_03")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnAnswerByPage")
	public PageList<EnAnswer> selectEnAnswerByPage(@RequestParam Map<String,Object> map){
		return enAnswerService.selectEnAnswerByPage(new JSONObject(map));
	}

}